package com.mew.chess.core.game.qmcs.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum QmcsLinkType {

    Prepare(0),  // "准备游戏"),
    Fish(1);   // "正常游戏"),


    private final int code;

    QmcsLinkType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, QmcsLinkType> stateMap
            = Arrays.stream(QmcsLinkType.values()).collect(Collectors.toMap(QmcsLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static QmcsLinkType parse(int code) {
        return stateMap.getOrDefault(code, QmcsLinkType.Prepare);
    }

}
